home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 April
/
EnigmA AMIGA RUN 06 (1996)(G.R. Edizioni)(IT)[!][issue 1996-04][Skylink CD V].iso
/
progs
/
editor
/
write-ed
/
rexx
/
openwrite.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-02-14
|
3KB
|
119 lines
/*
* WRITE V3.1536 © 1991-1995 by Tim Teulings startup script
* for ideal use set sleep mode in the configuration file
* This script was done by MGR, Asgrad -- Lars Hanke
* no copyrights claimed
*
* $VER Open.wrx 1.3 (15.2.95) Tim Teulings
*
* Template = "FILE,CONFIG,ScreenToFront=SCREEN/S,Background=RUN"
*
* FILE - name of file to be loaded into new ed
* CONFIG - config to be used when opening ed
* (defaults to "").
* ScreenToFront - bring to front when starting and to the back
* again when quitting. Usefull for starting WRITE
* from other screens.
* Background - return to shell immediately.
*
* History:
* 1.3 Make use of new "direct access to rexxvars"-feature (Tim Teulings)
* 1.2 use RexxDosSupport.library, added CONFIG option (hartmut Goebel)
* 1.1 added SCREEN option (Tim Teulings)
* 1.0 initial version
*/
ArgsTemplate = "FILE,CONFIG,ScreenToFront/S,Background=RUN/"
/* easy localization :-) */
Write.NotFound = "Kann WRITE nicht finden!"
Write.NoMorePorts = "REXX-SKript 'open.wrx':\nBekomme keinen ARexx-Port!"
/* english texts
Write.NotFound = "Can't find WRITE!"
Write.NoMorePorts = "REXX-script 'open.wrx':\nSorry, no more private ports!"
*/
call addlib('rexxdossupport.library', 0, -30, 2)
CONFIG=""; FILE=""; ScreenToFront = 0; Background = 0;
parse arg arguments
if strip(arguments) = '?' then do
address command 'echo noline "' ArgsTemplate ': "'
pull arguments
end; else nop
if ~ ReadArgs(arguments,ArgsTemplate) then do
say Fault(RC,ProgramName)
exit 10
end; else nop
drop arguments
call StartWrite()
FileName = file; drop file;
IF length(FileName)~=0 THEN DO
IF pos(':',FileName)=0 THEN DO
DirName=pragma('D')
IF right(DirName,1)~=':' THEN
DirName=DirName||'/'
FileName=DirName||FileName
END
END
ADDRESS "WRITE"
OPTIONS RESULTS
'NEWED "&CONFIG&"' /* open new Edit using config */
ID = RESULT
OPENPORT ID
Port = RESULT
IF Port = "" THEN DO
'MESSAGEOK &Write.NoMorePorts'
EXIT 20
END
INTERPRET ADDRESS Port
"WINDOW 0 0 0 0"
'SETVAR "_Path" &FileName'
IF length(FileName)~=0 THEN DO
IF exists(FileName) then
'OPEN &FileName'
ELSE
'SETVAR "_FileName" &FileName'
END
IF (ScreenToFront = TRUE) & (Background = FALSE) THEN DO
MODIFYSCREEN 0
END
IF (Background = FALSE) THEN DO
WAITPORT ID
END
IF (ScreenToFront = TRUE) & (Background = FALSE) THEN DO
IF show('P',"WRITE") THEN DO
ADDRESS "WRITE"
MODIFYSCREEN 1
END
END
EXIT
/* ---- */
StartWrite: PROCEDURE expose Write.NotFound
IF ~show('P',"WRITE") THEN DO
WRITEPATH = GetVar("WRITE")
IF RC ~= 0 THEN DO
say Write.NotFound
EXIT 20;
END;
ADDRESS COMMAND "run >NIL: <NIL:" WRITEPATH
ADDRESS COMMAND "WaitForPort <NIL: >NIL: WRITE" /* should be in command search path */
END